package com.lkm.app_ui.log;

import com.lkm.app_ui.help.LogHelp;
import com.lkm.app_ui.m.Imple.hsj522.ReadResponEntity;
import com.lkm.frame.P;
import com.lkm.frame.module.ModuleDelegate;
import com.lkm.javatool.ServerTimeSync;

import org.json.JSONObject;



public class SystemLogger {

    public static void onANR() {
        P.p("==== 本app ANR");
    }

    public static void log(String log) {
        if (P.isDebug())
        P.p("==== " + log);
    }


    public static void onReceiverPushClientID(String clientId) {
        P.p("===== pushKey:" + clientId);
    }

    public static void onModuleError(ModuleDelegate.ErrorWarp e) {
        if (P.isDebug())
            P.p(e.log);
    }

    public static class Net {
        public static void onServerTime(long servertime) {
            if (P.isDebug()) {
                P.p("=====服务器时间" + servertime);
                P.p("=====ServerTimeSync " + ServerTimeSync.getInstance().getServerCurTime());
            }
        }


        public static void onImageClassify(JSONObject res) {
            System.out.println("====" + res.toString());
        }
    }

    public static class UI {


        public static void onDialogFragmentNotUI() {
            P.p("====退光，退出");

        }

        public static void onPresentationFragmentNotUI() {
            P.p("====退光，退出");

        }
    }

    

    public static class UsbCDC {
        public static void onRead(int len) {
            P.p("====read " + len);
        }

    }

    

    public static class HSJ522 {

        public static boolean isDebug = false;

        public static void onReadStart() {
            P.p("=== 开始交流");
        }


        public static void onReadOK(byte[] data) {
            if (P.isDebug()) {

//                P.p("==== 接收到内容" + LogHelp.toString(data));
            }

        }


        public static void onReadInvalid(byte[] data) {
            if (P.isDebug()) {
                P.p("==== 接收到无效内容" + LogHelp.toString(data));
            }
        }


        public static void onReadBad(String logs) {
            if (P.isDebug()) {
                P.p("=====接受数据，无意义的数据：" + logs);
            }
        }


        public static void onReadStr1_0(ReadResponEntity respon) {
            P.p("=====读到1扇区0块 " + LogHelp.toString(respon.getData()));
        }


    }
}
